<script setup>
import useHomeStore from '@/stores/modules/home.js';
import { storeToRefs } from 'pinia';

const homeStore = useHomeStore();
const { categories } = storeToRefs(homeStore);
</script>

<template>
  <div class="categories">
    <template v-for="item in categories" :key="item.id">
      <div class="item">
        <img :src="item.pictureUrl" alt="" />
        <div class="text">{{ item.title }}</div>
      </div>
    </template>
  </div>
</template>

<style scoped>
.categories {
  display: flex;
  overflow-x: auto;
  height: 80px;
  padding: 0 10px;
  margin-top: 8px;
  &::-webkit-scrollbar {
    display: none;
  }
  .item {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 70px;
    flex-shrink: 0;
    text-align: center;
    .text {
      font-size: 12px;
      margin-top: 8px;
    }
    img {
      width: 32px;
      height: 32px;
    }
  }
}
</style>
